package org.alex.netShop.pages;

import java.util.LinkedList;



import org.alex.netShop.beans.CustomerBean;
import org.alex.netShop.interfaces.Customer;
import org.alex.netShop.interfaces.Customers;
import org.alex.netShop.interfaces.Purchase;
import org.apache.tapestry5.annotations.InjectPage;
import org.apache.tapestry5.annotations.Persist;
import org.apache.tapestry5.annotations.Property;
import org.apache.tapestry5.annotations.SetupRender;
import org.apache.tapestry5.ioc.annotations.Inject;

public class AddCustomer
{
	@Property
	@Persist
	private Customer customer;
	
	@InjectPage
	private ViewCustomer viewCustomerPage;
	@InjectPage
	private Error errorPage;
	@Inject
	private Customers customers;
	
	@SetupRender
	public void createObject() {
		customer = new CustomerBean();
		customer.setPurchase(new LinkedList<Purchase>());
	}
	void onSuccess(){
		customers.save(customer);
}
	

}
